home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMIBEST4.ADF / AmigaBasicStuff / BasicFunctionKeys < prev    next >
Text File  |  1987-07-22  |  1KB  |  45 lines

  1. In order to detect a FUNCTION KEY press in AMIGA (MicroSoft) BASIC,
  2. you must use a standard character input command such as INPUT, INPUT$,
  3. INKEY$, etc.
  4.  
  5. The FUNCTION KEYS return an ASCII code just as any other key does. The codes
  6. are:
  7.  
  8.       Function Key         ASCII Code
  9.       ------------         ----------
  10.  
  11.          1                    129
  12.          2                    130
  13.          3                    131
  14.          .                     .
  15.          .                     .
  16.          10                   138
  17.  
  18.  
  19. Just convert the input to ASCII using the ASC function and compare it to
  20. the above codes.
  21.  
  22. Here is some example code:
  23.  
  24.  
  25. CLRSCN:                                         'This clears the screen
  26.   PRINT CHR$(12)
  27.  
  28. GETAKEY:                                        'This waits for a key to
  29.   a$ = INKEY$                                   'be pressed
  30.     IF a$ = "" THEN GETAKEY
  31.       
  32. IF ASC(a$) > 128 AND ASC(a$) < 139 THEN         'This checks if the key
  33.                                                 'was a FUNCTION key
  34.  
  35. PRINT "You have pressed Function Key";(ASC(a$) - 128)   
  36.     ELSE                                                 
  37.       PRINT "That is not a Function Key..."     'This prints the answer
  38. END IF
  39.  
  40. FOR X = 1 TO 3000:NEXT                          'Short timer
  41.  
  42. GOTO CLRSCN                                     'Start over
  43.  
  44.         
  45.